#include "../feature.h"
#include <stdio.h>

void add_test () {
    printf("Features count = %d\n", mokoko_features_count(NULL));
    mokoko_feature_value_add(NULL, "Keroro", "No 1");
    printf("Features count after add Keroro 'No 1' = %d\n", mokoko_features_count(NULL));
    mokoko_feature_value_add(NULL, "Kululu", "No 2");
    printf("Features count after add Kululu 'No 2' = %d\n", mokoko_features_count(NULL));
    mokoko_feature_value_add(NULL, "Tomama", "No 3");
    printf("Features count after add Tomama 'No 3' = %d\n", mokoko_features_count(NULL));
    mokoko_feature_value_add(NULL, "Tomama", "Tom Toma Toma");
    printf("Features count after add Tomama 'Tom Toma Toma' = %d\n", mokoko_features_count(NULL));
    mokoko_feature_value_add(NULL, "Tomama", "yoyo");
    printf("Features count after add Tomama 'yoyo' = %d\n", mokoko_features_count(NULL));
    mokoko_feature_value_add(NULL, "Tomama", "yoyo");
    printf("Features count after add Tomama 'yoyo' = %d\n", mokoko_features_count(NULL));
    mokoko_feature_value_add(NULL, "Tomama", "yaya");
    printf("Features count after add Tomama 'yaya' = %d\n", mokoko_features_count(NULL));
    mokoko_feature_value_add(NULL, "Tomama", "yoyola");
    printf("Features count after add Tomama 'yoyola' = %d\n", mokoko_features_count(NULL));
    mokoko_feature_value_add(NULL, "Tomama", "yoyole");
    printf("Features count after add Tomama 'yoyole' = %d\n", mokoko_features_count(NULL));

}

void remove_test() {
    printf("Features count = %d\n", mokoko_features_count(NULL));
    printf("remove LALA where there does not LALA= %d\n", mokoko_feature_del(NULL, "LALA"));
    printf("Features count = %d\n", mokoko_features_count(NULL));
    printf("remove Keroro where there does have Keroro = %d\n", mokoko_feature_del(NULL, "Keroro"));
    printf("Features count = %d\n", mokoko_features_count(NULL));
    printf("Tomama Features count = %d\n", mokoko_features_count(NULL));
    printf("Remove yoyo in Tomama %d\n", mokoko_feature_value_del(NULL, "Tomama", "yoyo"));
    printf("Tomama Features count = %d\n", mokoko_features_count(NULL));
}


void feature_value_test() {
    printf("Length of Kululu = %d\n", mokoko_feature_value_count(NULL, "Kululu"));
    printf("Feature 'Kululu' 'No 1' test %d\n", mokoko_feature_has_value(NULL, "Kululu", "No 1"));
    printf("Feature 'Kululu' 'No 2' test %d\n", mokoko_feature_has_value(NULL, "Kululu", "No 2"));
    printf("Length of Tomama = %d\n", mokoko_feature_value_count(NULL, "Tomama"));
    printf("Feature 'Tomama' 'No 3' test %d\n", mokoko_feature_has_value(NULL, "Tomama", "No 3"));
    printf("Feature 'Tomama' 'No 4' test %d\n", mokoko_feature_has_value(NULL, "Tomama", "No 4"));
    printf("Feature 'Tomama' 'Tom Toma Toma' test %d\n", mokoko_feature_has_value(NULL, "Tomama", "Tom Toma Toma"));
}

void feature_value_get_test() {
    char const*value=mokoko_feature_value_get(NULL, "Tomama", 0);;
    int i=0;
    do {
        value=mokoko_feature_value_get(NULL, "Tomama", i);
        if (!value)
            return;
        printf("Feature Tomama[%d]=%s\n",i, value);
        i++;
    } while (1);
}


int main (void) {
    add_test();
    remove_test();
    feature_value_test();
    feature_value_get_test();
    mokoko_features_cleanup(NULL);
}
